<template>
	<view class="page" :style="{minHeight:$height()}">
		<view class="item">
			<view class="left">
				服务热线
			</view>
			<view class="right">
				<view class="tel">
					{{contact[0]}}
				</view>
				<view class="call" @click="callPhone()">
					立即拨打
				</view>
			</view>
		</view>
		<view class="item">
			<view class="left">
				联系邮箱
			</view>
			<view class="right">
				<view class="tel">
					{{contact[1]}}
				</view>
				<view class="call" @click="copy(contact[1])">
					复制
				</view>
			</view>
		</view>
		<view class="item">
			<view class="left">
				企业官网
			</view>
			<view class="right">
				<view class="tel">
					{{contact[2]}}
				</view>
				<view class="call" @click="copy(contact[2])">
					复制
				</view>
			</view>
		</view>
		<view class="item">
			<view class="left">
				企业地址
			</view>
			<view class="right">
				<view class="tel">
					{{contact[4]}}
				</view>
				<view class="call" @click="openMap">
					查看路线
				</view>
			</view>
		</view>
		
		<view class="footer">
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				contact:[]
			}
		},
		onLoad() {
			this.getContact()
		},
		methods: {
			openMap() {
				
				uni.openLocation({
					name: this.contact[3],
					address: this.contact[4],
					latitude: parseFloat(this.contact[6]),
					longitude: parseFloat(this.contact[5])
				})
			},
			callPhone() {
				uni.makePhoneCall({
					phoneNumber: this.contact[0]
				})
			},
			getContact(){
				this.$axios.request(this.$api.getParamsConfig,"GET",{
					config:"CONTACT"
				}).then((val) => {
					this.contact = val.data.paramValue.split(",")
				})
			},
			copy(str) {
				uni.setClipboardData({
					data: str, //要被复制的内容
					success: () => { //复制成功的回调函数
						this.$msg.toast("复制成功")
					}
				});
			}
		}
	}
</script>

<style>
	.page {
		width: 100%;
		background-color: #F0F2F5;
		overflow-y: hidden;
	}

	.item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 172rpx;
		background-color: #FFFFFF;
		margin: 16rpx 0 0;
		padding: 0 32rpx;
	}

	.right {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: flex-end;
		height: 100rpx;
	}

	.tel {
		height: 50rpx;
		font-size: 36rpx;
		font-family: "PingFang SC";
		font-weight: 300;
		line-height: 50rpx;
		text-align: right;
		color: #222222;
		opacity: 1;
	}

	.call {
		width: 130rpx;
		height: 40rpx;
		/* background: rgba(57, 117, 234, 0.39); */
		background-color: #3975EA;
		border-radius: 4rpx;
		font-size: 20rpx;
		font-family: "PingFang SC";
		font-weight: 400;
		line-height: 40rpx;
		color: #FFFFFF;
		text-align: center;
		opacity: 1;
		margin-top: 10rpx;
		margin-right: 60rpx;
	}

	.left {
		height: 50rpx;
		font-size: 36rpx;
		font-family: "PingFang SC";
		font-weight: 600;
		line-height: 50rpx;
		color: #333333;
		opacity: 1;
		text-align: left;
	}

	.footer {
		height: 100%;
		background-color: #FFFFFF;
		margin-top: 16rpx;
	}
</style>
